﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data.SqlClient;
using System.Data;
using System.Configuration;

public partial class main : System.Web.UI.MasterPage
{   
    string strconn = ConfigurationManager.ConnectionStrings["a123"].ToString();
    SqlConnection sqlconn;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ID"] == null)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
        }
        else 
        {
            Panel2.Visible = true;
            HyperLink4.Text = "欢迎用户" + Session["ID"];
            HyperLink4.NavigateUrl = "User_information.aspx";
            Panel1.Visible = false;
        }
        bind();
        //this.goodsint.Text = Session["goods"].ToString();
    }


    public void bind()
    {
        sqlconn = new SqlConnection(strconn);
        sqlconn.Open();
        string sqlstr = "select * from tb_Class";
        SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlconn);
        DataSet myds = new DataSet();
        myda.Fill(myds, "ClassID");

        GridView1.DataSource = myds;
        GridView1.DataKeyNames = new string[] { "ClassID" };
        GridView1.DataBind();
    }
}
